package org.front.client.utils;

import com.google.gwt.event.shared.GwtEvent;

public abstract class BaseEvent<T extends BaseHandler> extends GwtEvent<T> {

  /**
   * Event Context
   */
  public static class Context {

    private Object origin = null;

    public Object getOrigin() {
      return this.origin;
    }

    public void setOrigin(Object origin) {
      this.origin = origin;
    }
  }

  private final Context context;

  public BaseEvent() {
    this.context = new Context();
  }

  public BaseEvent(Context context) {
    this.context = context;
  }
  
  public abstract Type<T> getAssociatedType();
  
  protected abstract void dispatch(final T handler);

  public Context getContext() {
    return context;
  }
}

